<%@ page language="java" pageEncoding="UTF-8" %>
	<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
		<!DOCTYPE html>
		<html>

		<head>
			<title>后台管理</title>
			<meta charset="utf-8" />
			<base href="${pageContext.request.contextPath}/">
			<link rel="stylesheet" href="css/admin.css" />
			<script type="text/javascript" src="ueditor/ueditor.config.js"></script>
			<script type="text/javascript" src="ueditor/ueditor.all.js"></script>
			<script type="text/javascript">
				window.addEventListener("load", function () {
					var ue = UE.getEditor('container', {
						toolbars: [[
							'fullscreen', 'source', '|', 'undo', 'redo', '|',
							'bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'superscript', 'subscript', 'removeformat', 'formatmatch', 'autotypeset', 'blockquote', 'pasteplain', '|', 'forecolor', 'backcolor', 'insertorderedlist', 'insertunorderedlist', 'selectall', 'cleardoc', '|',
							'rowspacingtop', 'rowspacingbottom', 'lineheight', '|',
							'customstyle', 'paragraph', 'fontfamily', 'fontsize', '|',
							'directionalityltr', 'directionalityrtl', 'indent', '|',
							'justifyleft', 'justifycenter', 'justifyright', 'justifyjustify', '|', 'touppercase', 'tolowercase', '|',
							'imagenone', 'imageleft', 'imageright', 'imagecenter', '|',
							'inserttable', 'deletetable', 'insertparagraphbeforetable', 'insertrow', 'deleterow', 'insertcol', 'deletecol', 'mergecells', 'mergeright', 'mergedown', 'splittocells', 'splittorows', 'splittocols', 'charts', '|',
							'print', 'preview', 'searchreplace', 'drafts', 'help'
						]]
						, initialFrameWidth: 1000
					});
				});

			</script>
		</head>

		<body>
			<div class="container">
				<div id="header">
					<jsp:include page="header.jsp"></jsp:include>
				</div>
				<div id="admin_left">
					<ul class="submenu">
						<jsp:include page="left.jsp"></jsp:include>
					</ul>
					<div id="copyright"></div>
				</div>

				<div id="admin_right">
					<div class="content_box">
						<div class="content form_content">
							<form action="admin/goods?opr=update&gid=${goods.id}" method="post"
								enctype="multipart/form-data">
								<div id="table_box_1">
									<table class="form_table">
										<colgroup>
											<col width="150px">
											<col>
										</colgroup>
										<tbody>
											<tr>
												<th>商品名称：</th>
												<td><input class="normal" name="name" type="text"
														value="${goods.bookName}" disabled></td>
											</tr>
											<tr>
												<th>ISBN：</th>
												<td><input class="normal" name="ISBN" type="text"
														value="${goods.bookNum}" disabled></td>
											</tr>
											<tr>
												<th>作者：</th>
												<td><input class="normal" name="author" type="text"
														value="${goods.author}"><label>*</label></td>
											</tr>
											<tr>
												<th>出版社：</th>
												<td><input class="normal" name="publisher" type="text"
														value="${goods.press}"><label>*</label></td>
											</tr>
											<tr>
												<th>出版时间：</th>
												<td><input class="normal" name="pubTime" type="text"
														value="${goods.pressTime}"><label>*</label></td>
											</tr>
											<tr>
												<th>所属分类：</th>
												<td>
													<select class="auto" name="categoryId" id="category1">
														<option value="0">选择分类</option>
														<c:forEach items="${categories}" var="category">
															<option value="${category.id}">${category.categoryName}</option>
														</c:forEach>
													</select>

												</td>
											</tr>
											<tr>
												<th>基本数据：</th>
												<td>
													<div class="con">
														<table class="border_table">
															<thead id="goodsBaseHead">
																<tr>
																	<th>销量</th>
																	<th>库存</th>
																	<th>市场价格</th>
																	<th>销售价格</th>
																</tr>
															</thead>
															<tbody id="goodsBaseBody">
																<tr class="td_c">
																	<td><input class="small" name="salesNum" type="text"
																			value="${goods.salesNum}" /></td>
																	<td><input class="tiny" name="stock" type="text"
																			value="${goods.stock}"></td>
																	<td><input class="tiny" name="marketPrice"
																			type="text" value="${goods.marketPrice}">
																	</td>
																	<td><input class="tiny" name="salesPrice"
																			type="text" value="${goods.sellingPrice}">
																	</td>
																</tr>
															</tbody>
														</table>
													</div>
												</td>
											</tr>
											<tr>
												<th>缩略图：</th>
												<td>
													<input type="file" name="file" value="上传图片" />
													<div
														style="height: 380px;width: 380px; padding: 2px; float: right; margin-right: 150px;margin-top: -350px;">
														<div
															style="margin-top: 180px;margin-left: 60px; float: right; z-index: 2; position: absolute; font-size: 50px; color: red; opacity: 0.5;">
															<p>${site}</p>
														</div>

														<img src="${goods.img}" alt=""
															style="height: 350px;width: 350px; padding: 2px; z-index:0;display: block; border-radius: 10px;margin-top: 30px;">

													</div>
												</td>
											</tr>
											<tr>
												<th>产品描述：</th>
												<td>
													<script id="container" name="description"
														type="text/plain">${goods.describes}</script>
												</td>
											</tr>
											<tr>
												<th>最新，热卖</th>
												<td>是否最新：
													<c:if test="${goods.isNew==1}">
														<input type="checkbox" name="newest" value="1" checked />
													</c:if>
													<c:if test="${goods.isNew==-1}">
														<input type="checkbox" name="newest" value="1" />
													</c:if>
													是否热卖：
													<c:if test="${goods.isHot==1}">
														<input type="checkbox" name="hot" value="1" checked />
													</c:if>
													<c:if test="${goods.isHot==-1}">
														<input type="checkbox" name="hot" value="1" />
													</c:if>
												</td>
											</tr>
										</tbody>
									</table>
								</div>
								<table class="form_table" style="margin-top: -10px;">
									<colgroup>
										<col width="150px">
										<col>
									</colgroup>
									<tbody>
										<tr>
											<td></td>
											<td><button class="submit" type="submit">
													<span>修改商品</span>
												</button></td>
										</tr>
									</tbody>
								</table>
							</form>
						</div>
					</div>
				</div>
				<div id="separator"></div>
			</div>

		</body>
		<script>
            window.addEventListener("load", function () {
                document.getElementById("admin_right").addEventListener("click", function (e) {
                    if (e.target.id === "delID") {
                        if (confirm("确定删除吗？")) {
                            location.href = "admin/goods?opr=del&gid=" + e.target.getAttribute("data-gid");
                        }

                    }
                })
                if (${ goods.category.id == null }){
                document.getElementById("category1").value = "0";
            }else {
                document.getElementById("category1").value = "${goods.category.id}";
            }
            // 页码下拉框初始化
            document.getElementById("pselect").value = "${pageBean.currPage}";
            // 页面数据量大小
            document.getElementById("categorys").value = "${pageBean.pageSize}";
            });
            function goPage(p) {
                document.getElementById("p").value = p;
                document.getElementById("searchFrom").submit();
            }
            function goPageSize(psize) {
                // javascript:location.href='admin/goods?opr=select&pSize='+this.value;
                document.getElementById("pSize").value = psize;
                document.getElementById("searchFrom").submit();
            }
        </script>
		</html>